package day07.poker;

public class Player {
	Card[] cards;

	// 当创建Player对象时, 玩家手上容纳卡牌的容器应当随之初始化
	public Player() {
		this.cards = new Card[17];
	}

	public void shuffer(Poker poker) {
		//		Card[] cs = poker.cards;
		//		for (int i = 0; i < cs.length; i++) {}
		for (int i = 0; i < poker.cards.length; i++) {
			int ran;
			do {
				ran = (int) (Math.random() * poker.cards.length);
			} while (ran == i);

			Card tmp = poker.cards[i];
			poker.cards[i] = poker.cards[ran];
			poker.cards[ran] = tmp;
		}
	}

	public void deal(Poker poker, Player p1, Player p2) {
		//		this.cards;
		//		p1.cards;
		//		p2.cards;
		int index = 0;
		for (int i = 0; i < cards.length; i++) {
			this.cards[i] = poker.cards[index++];
			p1.cards[i] = poker.cards[index++];
			p2.cards[i] = poker.cards[index++];
		}
	}

}
